<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>boost/python/opaque_pointer_converter.hpp</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Boost.Python Reference Manual">
<link rel="up" href="../to_from_python_type_conversion.html" title="Chapter 5. To/From Python Type Conversion">
<link rel="prev" href="boost_python_lvalue_from_pytype_.html" title="boost/python/lvalue_from_pytype.hpp">
<link rel="next" href="boost_python_to_python_converter.html" title="boost/python/to_python_converter.hpp">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="" width="" height="" src="../../images/boost.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="boost_python_lvalue_from_pytype_.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../to_from_python_type_conversion.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="boost_python_to_python_converter.html"><img src="../../images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="to_from_python_type_conversion.boost_python_opaque_pointer_conv"></a><a class="link" href="boost_python_opaque_pointer_conv.html" title="boost/python/opaque_pointer_converter.hpp">boost/python/opaque_pointer_converter.hpp</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.introduction">Introduction</a></span></dt>
<dt><span class="section"><a href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.class_template_opaque_constructo">Class
        template <code class="computeroutput"><span class="identifier">opaque</span></code> constructor</a></span></dt>
<dt><span class="section"><a href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.macro_boost_python_opaque_specia">Macro
        <code class="computeroutput"><span class="identifier">BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID</span><span class="special">(</span><span class="identifier">Pointee</span><span class="special">)</span></code></a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="to_from_python_type_conversion.boost_python_opaque_pointer_conv.introduction"></a><a class="link" href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.introduction" title="Introduction">Introduction</a>
</h3></div></div></div>
<p>
          <code class="computeroutput"><span class="identifier">opaque</span><span class="special">&lt;&gt;</span></code>
          registers itself as a converter from Python objects to pointers to undefined
          types and vice versa.
        </p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">python</span>
<span class="special">{</span>
    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Pointee</span><span class="special">&gt;</span>
    <span class="keyword">struct</span> <span class="identifier">opaque</span>
    <span class="special">{</span>
        <span class="identifier">opaque</span><span class="special">();</span>
    <span class="special">};</span>
<span class="special">}}</span>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="to_from_python_type_conversion.boost_python_opaque_pointer_conv.class_template_opaque_constructo"></a><a class="link" href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.class_template_opaque_constructo" title="Class template opaque constructor">Class
        template <code class="computeroutput"><span class="identifier">opaque</span></code> constructor</a>
</h3></div></div></div>
<pre class="programlisting"><span class="identifier">opaque</span><span class="special">();</span></pre>
<div class="variablelist">
<p class="title"><b></b></p>
<dl class="variablelist">
<dt><span class="term">Effects</span></dt>
<dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
                    Registers the instance as a <a class="link" href="boost_python_lvalue_from_pytype_.html#to_from_python_type_conversion.boost_python_lvalue_from_pytype_.class_template_lvalue_from_pytyp" title="Class template lvalue_from_pytype"><code class="computeroutput"><span class="identifier">lvalue_from_pytype</span></code></a> converter
                    from Python objects into opaque pointers. The Python Objects
                    created are named after the type pointed to by the opaque pointer
                    being wrapped.
                  </li>
<li class="listitem">
                    Registers the instance as a <a class="link" href="boost_python_to_python_converter.html#to_from_python_type_conversion.boost_python_to_python_converter.class_template_to_python_convert" title="Class template to_python_converter"><code class="computeroutput"><span class="identifier">to_python_converter</span></code></a>
                    from opaque pointers to Python objects.
                  </li>
</ul></div></dd>
</dl>
</div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
            If there is already an instance registered by another module, this instance
            doesn't try to register again in order to avoid warnings about multiple
            registrations.
          </p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="to_from_python_type_conversion.boost_python_opaque_pointer_conv.macro_boost_python_opaque_specia"></a><a class="link" href="boost_python_opaque_pointer_conv.html#to_from_python_type_conversion.boost_python_opaque_pointer_conv.macro_boost_python_opaque_specia" title="Macro BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee)">Macro
        <code class="computeroutput"><span class="identifier">BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID</span><span class="special">(</span><span class="identifier">Pointee</span><span class="special">)</span></code></a>
</h3></div></div></div>
<p>
          This macro must be used to define specializations of the <a class="link" href="../utility_and_infrastructure/boost_python_type_id_hpp.html#utility_and_infrastructure.boost_python_type_id_hpp.functions" title="Functions"><code class="computeroutput"><span class="identifier">type_id</span></code></a> function which can't be
          instantiated for incomplete types.
        </p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
            The macro must be invoked in every translation unit which uses the opaque
            converter.
          </p></td></tr>
</table></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2002-2005, 2015 David Abrahams, Stefan Seefeld<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="boost_python_lvalue_from_pytype_.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../to_from_python_type_conversion.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="boost_python_to_python_converter.html"><img src="../../images/next.png" alt="Next"></a>
</div>
</body>
</html>
